(ns io.github.jmjoy.caipiao.comp)

(defn qixingcai
  "七星彩组合。"
  [f]
  (doseq [x (for [a1 (range 0 10)
                  a2 (range 0 10)
                  a3 (range 0 10)
                  a4 (range 0 10)
                  a5 (range 0 10)
                  a6 (range 0 10)
                  a7 (range 0 10)]
              [a1 a2 a3 a4 a5 a6 a7])]
    (f x)))

(defn shuangseqiu
  "双色球组合。"
  [f]
  (let [m 33
        n 6
        a (int-array (inc n))]
    (letfn
     [(comb [m n]
        (doseq [i (range m (dec n) -1)]
          (aset a n i)
          (if (> n 1)
            (comb (dec i) (dec n))
            (doseq [b (range 1 17)]
              (f [(rest (into [] a)) b])))))]
      (comb m n))))

